{{--前台详情页--}}
@extends('default.layouts.part_time_managePublic')
@section('title', '兼职职位管理')
{{--兼职详情页css--}}
@section('headcss')
    <meta name="keywords" content="{{Site::get('homekeywords')}}">
    <meta name="description" content="{{Site::get('homedescription')}}">
    @parent
    <link rel="stylesheet" type="text/css" href="{{asset('/default/css/company/welcome.css')}}">
    <link rel="stylesheet" href="{{asset('/default/css/part_time/manage.css')}}">
@endsection

{{--主体内容--}}
@section('content')
    {{--职位信息及侧边下载框--}}
    <div class="main">
        <div class="wrapper">
            <div class="asideNav">
                <ul>
                    @include('default.layouts.part_time_public_left')
                </ul>
            </div>
            {{--职位管理--}}
            <div class="jobManage">
                <ul class="switchNav">
                    <li class="active">正在招聘</li>
                </ul>
                <a class="publishJob" href="{{url('company/pt_create')}}"><i></i>发布兼职</a>
                {{--正在招聘--}}
                <div class="recruiting">
                    <div class="title">
                        <span class="jobName">兼职名称</span>
                        <span class="salary">工资待遇</span>
                        <span class="recruitNum">招聘人数</span>
                        <span class="state">状态</span>
                        <span class="updateTime">更新时间</span>
                        <span class="do">操作</span>
                    </div>
                    <form  class="jobs" name="thisForm" action="" method="post">
                        {!! csrf_field() !!}
                        <dl>
                            @if($list->count() == 0)
                                {{--空样式--}}
                                <dd class="noJob">
                                    <img src="{{ asset("/default/images/index/bgpic.jpg") }}">
                                    <p>对不起，您还未添加任何兼职信息!</p>
                                </dd>
                            @else
                                <dt>找到有效兼职<span>{{$list->total()}}</span>个</dt>
                                @foreach($list as $k => $v)
                                    <dd>
                                        <span class="jobName">
                                            <input name="selected_id[]" class="checkbox" value="{{$v->id}}"
                                                   type="checkbox"/>
                                            <a class="tipTitle" href="{{url('company/pt_show')}}_{{$v->id}}.html"
                                               target="_blank">{{str_limit($v->title,22)}}</a>
                                        </span>
                                        <span class="salary">{{$v->salary_price}}{{$v->salary_unit_name}}</span>
                                        <span class="recruitNum">@if($v->need_num==0){!! '若干' !!}@else{{$v->need_num}}@endif
                                            名</span>
                                        <span class="state">
                                            @if($v->job_status==0)
                                                <a class="s_audit" href="javascript:void(0)">审核中</a>
                                            @elseif($v->job_status==1)
                                                <a class="s_publish" href="javascript:void(0)">发布中</a>
                                            @elseif($v->job_status==2)
                                                <a class="s_audit" href="javascript:void(0)">屏蔽中</a>
                                            @endif
                                        </span>
                                        <span class="updateTime">{{$v->last_update_time}}</span>
                                        <span class="do">
                                            <a class="edit" href="{{url('company/pt_edit')}}_{{$v->id}}.html" data-text="编辑"></a>
                                            @if($v->job_status==0)
                                                <a class="audit" href="javascript:void(0)" id="audit" data-text="审核中"></a>
                                            @elseif($v->job_status==1)
                                                <a class="shield" href="{{url('company/pt_change_status')}}?id={{$v->id}}&job_status=2" data-text="屏蔽"></a>
                                            @elseif($v->job_status==2)
                                                <a class="active" href="{{url('company/pt_change_status')}}?id={{$v->id}}&job_status=1" data-text="激活"></a>
                                            @endif
                                            <a class="delete"
                                               onclick="destroy('{{url('company/pt_del')}}?id={{$v->id}}','您真的要删除这个兼职吗?')"
                                               href="javascript:void(0)" data-text="删除"></a>
                                        </span>
                                    </dd>
                                @endforeach
                                <dd class="action">
                                    <input name="selectAll" id="selectAll" class="checkbox" type="checkbox"
                                           onclick="checkAll(this)"/>
                                    <label for="selectAll">全选</label>
                                    <button type="button" class="refresh" onclick="showConfirm('{{url('company/pt_refresh')}}','refresh')">刷新兼职</button>
                                    <button type="button" class="delete" onclick="showConfirm('{{url('company/pt_del')}}','delete')">删除</button>
                                </dd>
                                {{--分页--}}
                            @endif
                        </dl>
                        <div class="page_list">
                            {!! $list->links() !!}
                        </div>
                    </form>
                </div>
            </div>
            {{--职位管理结束--}}
        </div>
    </div>
    {{--职位信息及侧边下载框结束--}}
@endsection
{{--兼职详情页js--}}
@section('footerjs')
    @parent
    <script type="text/javascript" src="{{asset('/default/js/part_time/pt_manage.js')}}"></script>
    <script>
        $(function () {
            //消息检测
            layer.ready(function(){
                if ('{{ Session::has('msg')}}') {
                    layer.msg('{{ Session::get('msg')}}');
                }
            });
            //审核中弹窗
            $('#audit').click(function () {
                layer.msg('该职位还在审核，不能操作');
            });
            //侧边导航栏点击事件
            $('.main .wrapper .asideNav ul').on('click.asideNav', 'li', function () {
                var url = $(this).attr('data-href');
                window.location.href = url;
            });
            //操作按钮提示
            $('.main .jobManage .jobs .do').on('mouseenter.do', 'a', function () {
                var text = $(this).attr('data-text');
                layer.tips(text, $(this), {
                    tips: [1, '#000'],
                    time: 3000
                });
            });
            //点击查看兼职详情Tip弹窗
            $('.tipTitle').mouseover(function(){
                var TextTip = layer.tips('点击查看兼职详情', this, {tips: 3});
                $(this).mouseout(function(){
                    layer.close(TextTip);
                });
            });
        });
    </script>
@endsection